﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;
using System.Windows;
using System.Windows.Media;

namespace DesktopRibbon
{
    class TestAdorner : Adorner
    {
        #region Fields

        private Helper.Corner corner;


        #endregion

        #region Constructors

        public TestAdorner(UIElement adornedElement) : base (adornedElement)
        {
            
        }

        #endregion

        #region Properties

        public Helper.Corner Corner
        {
            get
            {
                return corner;
            }
            set
            {
                corner = value;
                InvalidateVisual();
            }
        }

        #endregion

        #region Methods

        protected override void OnRender(DrawingContext drawingContext)
        {
            var brush = Brushes.Red;
            var pen = new Pen (Brushes.Blue, 0.5);
            var r = new Rect (new Point (0, 0), this.AdornedElement.DesiredSize);
            r.Width = r.Width - 1;

            switch (corner)
            {
            case Helper.Corner.Left:
                drawingContext.DrawLine(pen, r.TopLeft, r.BottomLeft);
                break;
            case Helper.Corner.Top:
                drawingContext.DrawLine(pen, r.TopLeft, r.TopRight);
                break;
            case Helper.Corner.Right:
                drawingContext.DrawLine(pen, r.TopRight, r.BottomRight);
                break;
            case Helper.Corner.Bottom:
                drawingContext.DrawLine(pen, r.BottomLeft, r.BottomRight);
                break;
            }
        }

        #endregion
    }
}
